<!DOCTYPE html>
<html>
	<head>
	    <meta charset="utf-8">
	    <meta name="viewport" content="maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, initial-scale=1.0, width=device-width" />
	    <meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
	    <title>Hello APP</title>
	    <link rel="stylesheet" type="text/css" href="../../../css/index.css" />
	</head>
	<style type="text/css">
		.warp{width: 100%;}

		/*订单头部*/
		.sta-box{width: 100%;height: 100px;flex-direction: column;justify-content: center;background:#FF9502;padding-left: 15px;box-sizing:border-box;position: relative;}
		.sta-box .t1{font-size: 16px;color: #FFFFFF;font-weight: 500;}
		.sta-box .t2{font-size: 13px;color: #FFFFFF;font-weight: 500;padding-top: 6px;box-sizing: border-box;}
		.sta-box .sta-img{width: 56px;height: 56px;position: absolute;top: 22px;right: 20px;}
		.sta-box .sta-img img{width: 100%;height: 100%;}

		/*退款金额*/
		.tui-price{width: 100%;height: 50px;background: #FFFFFF;font-size: 15px;color: #333333;align-items: center;padding: 0 15px;
		box-sizing: border-box;margin-bottom: 10px;}
		.tui-price .r{text-align: right;}

		/*物流信息*/
		.tuikuan-warp{width: 100%;background: #FFFFFF;margin-bottom: 10px;}
		.tuikuan-warp .tuikuan-text{width: 100%;height: 50px;line-height: 50px;background: #FFFFFF;font-size: 15px;color: #333333;padding: 0 15px;box-sizing: border-box;}
		.tuikuan-warp .tuikuan-box{width: 100%;background: #FFFFFF;padding: 20px 0 20px 15px;box-sizing: border-box;}
		.tuikuan-warp .img-box{padding: 0 15px;align-items: center;justify-content: center;flex-shrink: 0;}
		.tuikuan-warp .img-box img{width: 22px;height: 22px;}
		.tuikuan-warp .tuikuan-info{align-items: center;padding-right: 15px;box-sizing: border-box;}
		.tuikuan-warp .tuikuan-info .name{font-size: 14px;color: #333333;font-weight: 700;padding-bottom: 4px;box-sizing: border-box;}
		.tuikuan-warp .tuikuan-info .text{font-size: 14px;color: #666666;}
		.tuikuan-warp .tuikuan-info .time{box-sizing: border-box;font-size: 13px;color: #999999;padding-top: 6px;}

		/*物流信息*/
		.wuliu-warp{width: 100%;background: #FFFFFF;margin-bottom: 10px;}
		.wuliu-warp .wuliu-text{width: 100%;height: 50px;line-height: 50px;background: #FFFFFF;font-size: 15px;color: #333333;padding: 0 15px;box-sizing: border-box;}
		.wuliu-warp .wuliu-box{width: 100%;background: #FFFFFF;padding: 20px 0;box-sizing: border-box;}
		.wuliu-warp .img-box{padding: 0 15px;align-items: center;justify-content: center;flex-shrink: 0;}
		.wuliu-warp .img-box img{width: 22px;height: 22px;}
		.wuliu-warp .wuliu-info{align-items: center;padding-right: 15px;box-sizing: border-box;}
		.wuliu-warp .wuliu-info .name{font-size: 14px;color: #333333;font-weight: 700;}
		.wuliu-warp .wuliu-info .text{font-size: 14px;color: #666666;}
		.wuliu-warp .wuliu-info .time{box-sizing: border-box;font-size: 13px;color: #999999;padding-top: 6px;}

		/*地址信息*/
		.tui-info{width: 100%;background: #FFFFFF;margin-bottom: 10px;}
		.tui-info .tui-text{width: 100%;height: 50px;background: #FFFFFF;line-height: 50px;padding: 0 15px;box-sizing: border-box;font-size: 14px;color: #333333;}
		.tui-info .addr-box{width: 100%;background: #FFFFFF;padding: 20px 0;box-sizing: border-box;}
		.tui-info .addr-box .img-box{padding: 0 15px;align-items: center;justify-content: center;}
		.tui-info .addr-box .img-box img{width: 22px;height: 22px;flex-shrink: 0;}
		.tui-info .addr-box .addr-info{align-items: center;}
		.tui-info .addr-box .addr-info .top-box{font-size: 14px;color: #333333;align-items:center;font-weight:700;}
		.tui-info .addr-box .addr-info .top-box .phone{padding-left: 10px;box-sizing: border-box;}
		.tui-info .addr-box .addr-info .address{font-size: 14px;color: #666666;padding-top:6px;box-sizing: border-box;word-wrap:break-word}
		.tui-info .liuyan-box{width: 100%;box-sizing: border-box;padding: 15px;box-sizing: border-box;}
		.tui-info .liuyan-box .text{font-size: 14px;color: #333333;flex-shrink: 0;}
		.tui-info .liuyan-box .content{font-size: 14px;color: #666666;padding: 1px 0 0 6px;word-break: break-word;}
		.tui-info .input-wuliu{width: 100%;height: 54px;padding: 0 15px;box-sizing: border-box;align-items:center;}
		.tui-info .input-wuliu .input-btn{width:88px;height:34px;border-radius:4px;border:1px solid #D2D2D2;box-sizing: border-box;text-align: center;line-height:34px;color: #333333;}
		.tui-info .input-wuliu .text{text-align: right;color: #999999;padding-right: 6px;box-sizing: border-box;}
		.tui-info .input-wuliu .goto{width: 12px;height: 12px;}

		/*商品信息*/
		.order-title{width: 100%;height: 50px;line-height: 50px;background: #FFFFFF;font-size: 15px;color: #333333;padding: 0 15px;box-sizing: border-box;}
		.order-shop{width: 100%;background: #FFFFFF;padding: 20px 15px;box-sizing: border-box;background: #FFFFFF;}
		.order-shop .img-box{width: 92px;height: 92px;overflow: hidden;}
		.order-shop .img-box img{width: 100%;}
		.order-shop .shop-info{padding-left: 12px;box-sizing: border-box;position: relative;}
		.order-shop .shop-info .name{font-size: 14px;color: #333333;height: 42px;}
		.order-shop .shop-info .guige-box{align-items: center;color:#8E9194;font-size: 12px;padding-top: 2px;box-sizing: border-box;}
		.order-shop .shop-info .price{width: 100%;padding-top: 6px;box-sizing: border-box;font-size: 16px;color: #FF9502;font-weight:500;}

		/*订单信息*/
		.order-info{width: 100%;background: #FFFFFF;padding: 24px 15px;box-sizing: border-box;margin-bottom: 10px;}
		.order-info .title{height: 18px;font-size: 16px;color: #333333;position: relative;top: 0;left: 0;line-height: 18px;padding-left: 10px;margin-bottom: 10px;}
		.order-info .title:after{display: block;content:"";width: 4px;height: 100%;background: #FF9502;position: absolute;top: 0;left: 0;}
		.order-info .info-one{align-items: center;height: 30px;}
		.order-info .info-one .l{font-size: 14px;color:#333333;}
		.order-info .info-one .r{font-size: 14px;color:#999999;padding-left: 10px;box-sizing: border-box;}

		/*底部固定按钮*/
		.fixed_btn{position: fixed;bottom: 0;left: 0;height: 60px;background: #ffffff;z-index: 999;right: 0;}
		.fixed_btn .btn-box3{width: 100%;height: 100%;padding: 8px 15px;box-sizing: border-box;line-height: 44px;}
		.fixed_btn .btn-box3 .btn1{width: 120px;border-radius: 30px;text-align: center;font-size: 15px;background: #ffffff;margin-right: 12px;color: #FF9502;
		border: 1px solid #FF9502;box-sizing: border-box;}
		.fixed_btn .btn-box3 .btn3{border-radius: 30px;text-align: center;font-size: 15px;background: #FF9502;color: #ffffff;}

	</style>
	<body>
		<div id="vue" class="warp">

			<!--订单头部-->
			<div class="sta-box flex">
				<div class="t1" v-text="Pdata.status_str"></div>
				<div class="t2" v-if="Pdata.status == 1 && Pdata.endtype == 1">
					还剩<i id="over-time"></i>
				</div>
				<div class="sta-img" >
					<img  v-if="Pdata.status == 0" src="../../../image/main3/tui_order_sta1.png" >
					<img  v-if="Pdata.status == 1" src="../../../image/main3/tui_order_sta2.png" >
					<img  v-if="Pdata.status == 2" src="../../../image/main3/tui_order_sta3.png" >
					<img  v-if="Pdata.status == 9" src="../../../image/main3/tui_order_sta5.png" >
					<img  v-if="Pdata.status == 3" src="../../../image/main3/tui_order_sta4.png" >
				</div>
			</div>

			<!--退款金额-->
			<div class="tui-price flex">
				<div class="l">退款总金额</div>
				<div class="r flex1">¥<i v-text="Pdata.tui_price"></i></div>
			</div>

			<!--等待商家收货并退款-->
			<!-- <div class="tuikuan-warp" v-if="Pdata.status == 3">
				<div class="tuikuan-text border-bottom">等待商家收货并退款</div>
				<div class="tuikuan-box flex">
					<div class="tuikuan-info flex1">
						<div class="name">退货物流:申通快递(12345678901)</div>
						<div class="text">收件人:<i>小豆子</i>  手机号:<i>186****7777</i></div>
						<div class="text">浙江省杭州市萧山区经济开发区红垦农场6号楼602室</div>
						<div class="time">2020.01.08 16:00</div>
					</div>
				</div>
			</div> -->

			<!--物流信息-->
			<div class="wuliu-warp" v-if="Pdata.status == 2">
				<div class="wuliu-text border-bottom">客户退货物流信息,请注意查收</div>
				<div class="wuliu-box flex">
					<div class="img-box flex">
						<img src="../../../image/main3/wuliu_icon.png"/>
					</div>
					<div class="wuliu-info flex1">
						<div class="name">退货物流: <i v-text="Pdata.kd_name"></i>(<i v-text="Pdata.kd_code"></i>)</div>
						<div class="text">联系人电话: <i v-text="Pdata.kd_phone"></i></div>
						<div class="time" v-text="Pdata.kd_time"></div>
					</div>
				</div>
			</div>

			<!--地址信息-->
			<div class="tui-info" v-if="Pdata.tui_data && Pdata.status == 1">
				<div class="tui-text border-bottom">已同意退货退款(退货信息)</div>
				<div class="addr-box flex border-bottom">
					<div class="img-box flex">
						<img src="../../../image/main3/addr_icon.png"/>
					</div>
					<div class="addr-info flex1">
						<div class="top-box flex">
							<div class="name">收件人:<i v-text="Pdata.tui_data.uname"></i></div>
							<div class="phone">手机号:<i v-text="Pdata.tui_data.phone"></i></div>
						</div>
						<div class="address" v-text="Pdata.tui_data.qustr + Pdata.tui_data.address"></div>
					</div>
				</div>
			</div>

			<!--商品信息-->
			<div class="order-title border-bottom">退款信息</div>
			<div class="order-shop flex border-bottom" :data-id="Pdata.sid" tapmode onclick="open_goods(this);">
				<div class="img-box">
					<img :src="Pdata.image"/>
				</div>
				<div class="shop-info flex1">
					<div class="name han_2" v-text="Pdata.title"></div>
					<div class="guige-box flex">
						<div class="guige flex1 han_1" v-if="Pdata.ggstr" v-text="Pdata.ggstr"></div>
						<div class="guige flex1" v-if="!Pdata.ggstr"></div>
						<div class="num">x<i v-text="Pdata.buynum"></i></div>
					</div>
					<div class="price">¥<i v-text="Pdata.price"></i></div>
				</div>
			</div>

			<!--订单信息-->
			<div class="order-info">
				<div class="info-one flex">
					<div class="l">服务编号</div>
					<div class="r flex1" v-text="Pdata.orderid"></div>
				</div>
				<div class="info-one flex">
					<div class="l">退款原因</div>
					<div class="r flex1" v-text="Pdata.tui_type"></div>
				</div>
				<div class="info-one flex">
					<div class="l">退款金额</div>
					<div class="r flex1">¥<i v-text="Pdata.tui_price"></i></div>
				</div>
				<div class="info-one flex">
					<div class="l">申请件数</div>
					<div class="r flex1" v-text="Pdata.tui_num"></div>
				</div>
				<div class="info-one flex">
					<div class="l">申请时间</div>
					<div class="r flex1" v-text="Pdata.addtime"></div>
				</div>
				<div class="info-one flex" v-if="Pdata.status == 3">
					<div class="l">退款状态</div>
					<div class="r flex1" v-text="Pdata.status_str"></div>
				</div>
			</div>

			<div style="width:100%;height:100px;"></div>

			<!--底部按钮-->
			<div class="fixed_btn" :style="{ display:(Pdata.status < 3 && Pdata.status != 1 ? '':'none')}">
				<div class="btn-box3 flex">
					<div class="btn1" :data-id="Pdata.id" :data-sta="Pdata.status" tapmode onclick="noTuiHuo(this)">不同意</div>
					<div class="btn3 flex1" :data-id="Pdata.id" :data-sta="Pdata.status" :data-fahuo="Pdata.isfahuo" tapmode onclick="okTuiHuo(this)">
						<i v-if="Pdata.isfahuo == 0 && Pdata.status == 0">同意退款</i>
						<i v-if="Pdata.isfahuo == 1 && Pdata.status == 0">同意退货</i>
						<i v-if="Pdata.isfahuo == 1 && Pdata.status == 2">同意退款</i>
					</div>
				</div>
			</div>

		</div>
	</body>
</html>
<script type="text/javascript" src="../../../script/base.min.js" id="loadjs" data-js="L/swiper.min,L/lazyload,L/h-tool"></script>
<script type="text/javascript">
	define(function (require, exports, module) {

		pageParam = api.pageParam;
		_page.getData = function(loading) {
			//console.log(pageParam.id);
			lanYun.getVueData({url:'store/Ordertui/show',get:{orderid:pageParam.id},cache:0,loading:loading},function(ret) {
				//console.log(JSON.stringify(ret));
				if(ret.errcode == 0){
					if(ret.data.status == 1 && ret.data.endtype == 1 && ret.data.endmiao > 0){
						countDown(ret.data.endmiao);
					}
				}else {
					lanYun.toast(ret.msg);
				}
			});
		};

		lanYun.newVue('#vue',function() {
			_page.getData(2);
		});

		onShow = function () {
			var reshpage = lanYun.getStorage('reshpage');
			if(reshpage){
				lanYun.ajaxPageSta = 0; lanYun.page = 1;
				_page.getData(2);
				api.execScript({ name:pageParam.winName, frameName:pageParam.frameName, script:'intGetData();'});
			}
		}

		//去填写物流信息
		inputWuLiu = function (tis) {
			var dst = tis.dataset;
	        lanYun.openWin('ordert/input_wuliu.html', {
				title:"物流信息",
	        	frameParam : {id:dst.id,phone:dst.phone},
	        });
		}

		//拒绝退款
		noTuiHuo = function (tis){
			var dst = tis.dataset;
			lanYun.alert({fname:'diaLogBox1',title:'提示', button:['取消','确定'],content: '您要拒绝退款吗？'},function(ret){
	            if (ret.index == 0) return;
				lanYun.get('store/Ordertui/nopass?id=' + dst.id ,function (ret){
					lanYun.toast(ret.msg);
					if(ret.errcode == 0){
						intGetData();
						api.execScript({ name:pageParam.winName, frameName:pageParam.frameName, script:'intGetData();'});
					}
				},2)
	        });
		}

		//确定退款
		okTuiHuo = function (tis){
			var dst = tis.dataset;
			if(dst.fahuo == 0 && dst.sta == 0){
				lanYun.alert({fname:'diaLogBox1',title:'提示', button:['取消','确定'],content: '您要同意退款吗？'},function(res){
		            if (res.index == 0) return;
					lanYun.post('store/Ordertui/pass',{id:dst.id},function (ret){
						lanYun.toast(ret.msg);
						if(ret.errcode == 0){
							intGetData();
							api.execScript({ name:pageParam.winName, frameName:pageParam.frameName, script:'intGetData();'});
						}
					},2)
		        });
			}
			if(dst.fahuo == 1 && dst.sta == 0){
				lanYun.openWin('main3/store/store_address_sel.html', {
					title:"选择退货地址",
					menu:"添加地址",
		        	frameParam : {id:dst.id},
		        });
			}
			if(dst.fahuo == 1 && dst.sta == 2){
				lanYun.alert({fname:'diaLogBox1',title:'提示', button:['取消','确定'],content: '您要同意退款吗？'},function(res){
		            if (res.index == 0) return;
					lanYun.get('store/Ordertui/confirmRefund?id=' + dst.id ,function (ret){
						lanYun.toast(ret.msg);
						if(ret.errcode == 0){
							intGetData();
							api.execScript({ name:pageParam.winName, frameName:pageParam.frameName, script:'intGetData();'});
						}
					},2)
		        });
			}
		}

		//打开商品详情
		open_goods = function (tis) {
			var dst = tis.dataset;
			lanYun.openWin('goods/show', {
				win:'none',
				frameParam : dst,
			});
		}

		//倒计时
		function countDown(times) {
			var fun = function(){
				var day = 0,
					hour = 0,
					minute = 0,
					second = 0;//时间默认值
				if (times > 0) {
					day = Math.floor(times / (24 * 60 * 60));
					hour = Math.floor(times / (60 * 60)) - (day * 24);
					minute = Math.floor(times / 60) - (day * 24 * 60) - (hour * 60);
					second = Math.floor(times) - (day * 24 * 60 * 60) - (hour * 60 * 60) - (minute * 60);
				}
				if(day > 0){
					var time = day+'天'+hour+'小时'+minute+'分'+second+'秒';
				}
				if(hour > 0 && day <= 0){
					var time = hour+'小时'+minute+'分'+second+'秒';
				}
				if(minute > 0 && hour <= 0 && day <= 0){
					var time = minute+'分'+second+'秒';
				}
				if(second > 0 && minute <= 0 && hour <= 0 && day <= 0){
					var time = second+'秒';
				}
				$('#over-time').text(time);
				times--;
				if (times <= 0) {
					clearInterval(timer);
					setTimeout(function (){
						lanYun.ajaxPageSta = 0; lanYun.page = 1;
						_page.getData(2);
						lanYun.event('uporderNum');
					}, 1000)
				}
			};
			fun();
			var timer = setInterval(function () {
				fun();
			}, 1000);
		}

		//刷新列表
		intGetData = function () {
			lanYun.ajaxPageSta = 0; lanYun.page = 1;
			_page.getData(2);
		}


	});
</script>
